home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 03 - 1987 / 03.11 Nov 87 / C string library / PStrLib Source / PStrDel.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-21  |  402 b   |  22 lines  |  [TEXT/KAHL]

  1. /*    FILE:    PStrDel.c
  2.     Deletes count chars from pos of dst. */
  3. #include    "PStrLib.h"
  4.  
  5. PStrDel(s, pos, count)
  6. register unsigned char    *s;        /* Pascal string */
  7. register int            pos, count;
  8. {    
  9.     register    unsigned char    *t;
  10.     register    int                shift;
  11.     
  12.     if (*s) {
  13.         if (--pos + count > *s)
  14.             count = *s - pos;
  15.         shift = *s - pos;
  16.         *s -= count;
  17.         s += pos;
  18.         t = s + count;
  19.         while (--shift >= 0)
  20.             *++s = *++t;
  21.     }
  22. }